package com.youku.model;

import java.util.List;

public class ResponseBody {

	/**
	 * 响应码,0代表没有数据，1代表有数据
	 */
	private int code;

	private int size;

	private List<LogModel> body;

	private LogModel latest;

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	public List<LogModel> getBody() {
		return body;
	}

	public void setBody(List<LogModel> body) {
		this.body = body;
	}

	public int getSize() {
		return size;
	}

	public void setSize(int size) {
		this.size = size;
	}

	public LogModel getLatest() {
		return latest;
	}

	public void setLatest(LogModel latest) {
		this.latest = latest;
	}

	public static ResponseBody createResponse(List<LogModel> model) {
		ResponseBody rb = new ResponseBody();
		if (model.isEmpty()) {
			rb.code = 0;
		} else {
			rb.code = 1;
			rb.latest = model.get(model.size() - 1);
		}
		rb.body = model;
		rb.size = model.size();
		return rb;
	}

}
